package com.example.testproject.activity

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.testproject.MainActivity
import com.example.testproject.R
import com.example.testproject.adapter.TextAdapter
import com.example.testproject.ext.click
import com.google.android.material.bottomsheet.BottomSheetDialog
import kotlinx.android.synthetic.main.activity_measure.*

/**
 *
 * @ClassName: MeasureActivity
 * @Author: android 超级兵
 * @CreateDate: 4/8/22$ 10:29 AM$
 * TODO
 */
class MeasureActivity : AppCompatActivity() {
    @SuppressLint("InflateParams")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_measure)
        val bottomSheetDialog = BottomSheetDialog(this)
        bottomSheetDialog.setContentView(R.layout.recylcer_view)
        bottomSheetDialog.also {
            val recyclerView = bottomSheetDialog.findViewById<RecyclerView>(R.id.rootRecyclerView)
            recyclerView?.adapter = TextAdapter(('A'..'Z').map { "$it" }.toList())
            recyclerView?.layoutManager =
                LinearLayoutManager(applicationContext, LinearLayoutManager.VERTICAL, false)
        }
        testBtn.click {
            bottomSheetDialog.show()
        }
    }
}